﻿#region Using directives

using System;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using Microsoft.ApplicationBlocks.Data;
using MCMLXVII.BackEnd.Data.SystemDatabase.DataSets;


#endregion

namespace MCMLXVII.BackEnd.Data.SystemDatabase
{
    public class MultiLingualContents
    {
        public MultiLingualContents()
        {
        }

        public static DSLocales.LocalesDataTable GetLocales()
        {
            DSLocales.LocalesDataTable dt = new DSLocales.LocalesDataTable();
            dt.Load(SqlHelper.ExecuteReader(System.Data.CommandType.Text, "SELECT Language, Description, MapsToLanguage, DecimalPoint, ThousandsSeparator, ListSeparator, DateFormat, ImplementsXLatedInterfase, ImplementsXLatedContents FROM dbo.Locales"));
            if (dt.Rows.Count > 0)
                return dt;
            else
                return null;
        }

        public static DSLocales.LocalesDataTable GetContentLocales()
        {
            DSLocales.LocalesDataTable dt = new DSLocales.LocalesDataTable();
            dt.Load(SqlHelper.ExecuteReader(System.Data.CommandType.Text, "SELECT Language, Description, MapsToLanguage, DecimalPoint, ThousandsSeparator, ListSeparator, DateFormat, ImplementsXLatedInterfase, ImplementsXLatedContents FROM dbo.Locales where ImplementsXLatedContents='Y'"));
            if (dt.Rows.Count > 0)
                return dt;
            else
                return null;
        }


        public static string GetMemberLanguage(int MemberID)
        {
            return (string)SqlHelper.ExecuteScalar(CommandType.Text, "select dbo.GetMemberLanguage(" + MemberID + ")");
        }

        public static string GetDefaultLanguage()
        {
            return (string)SqlHelper.ExecuteScalar(CommandType.Text, "select dbo.GetDefaultLanguage()");
        }

    }
}
